<?php
//把小数点后面多余的零给去掉
	function floats($price){
		foreach($price as $k=>$v){
			$v["price"] = isset($v["price"]) ? $v["price"] :"";
			$price[$k]["price"] = (float)$v["price"];
		}
		return $price;
	}
//轮播；
	function lunbo($num){
		$db = M("lunbo");
		$res = $db -> where("cid=$num") -> all();
		return $res;
	}
//读表；读取图片的基本内容；读表方法一； 
	function readtable($catid,$num){
		$db = K("picbase");
		$result = $db  -> where("pic_base.catid=$catid") -> limit($num) -> all();
		$result = floats($result);
		return $result;
	}
//读表方法二；
	function readtable1($catid,$num){
		$db = K("pic_base");
		$result = $db -> join("category") -> where("category.catid=$catid") -> limit($num) -> all();
		$result = floats($result);
		return $result;
	}
//排列的，只读取几条记录的；
	function readnotes($order,$ziduan,$desc,$num){
		$db = K("pic_base");
		$order = $db -> join("$order") -> order("$ziduan $desc") -> limit($num) -> all();
		return $order;
	}	
//只需要读图片基本信息表；
	function readpicbase($tablename,$where,$ziduan,$desc,$num){
		$db = M("$tablename");
		$rows = $db -> where("$where") -> order("$ziduan $desc") -> limit($num) ->all();
		return $rows;
	}

?>